package practice.design.factory;

public class Test {
    public static void main(String[] args) throws Exception{
        //基础版
        AnimalFactory factory = new AnimalFactory();
        Dog dog = (Dog) factory.creat("dog");


        //升级版
        Cat cat = (Cat) AnimalFactory.creatSuper(Cat.class);
        //AnimalFactory.creat(Pig.class); // 编译错误 Pig类没有继承Animal

    }
}
